package com.wk.paradise.main.bean.pojo;

/**
 * @Classname ResultPojo
 * @Description TODO
 * @Date 2019/12/26 17:12
 * @Author by weikai
 */
public class ResultPojo<T> {

  private String msg;

  private int code;

  private boolean status;

  private T data;

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public boolean isStatus() {
    return status;
  }

  public void setStatus(boolean status) {
    this.status = status;
  }

  public T getData() {
    return data;
  }

  public void setData(T data) {
    this.data = data;
  }

  private ResultPojo(String msg, int code, boolean status, T data) {
    this.msg = msg;
    this.code = code;
    this.status = status;
    this.data = data;
  }

  public static ResultPojo OK_RESULT(Object data){
    ResultPojo resultPojo = new ResultPojo("成功",200,true,data);
    return resultPojo;
  }

  public static ResultPojo ERROR_RESULT(Object data){
    ResultPojo resultPojo = new ResultPojo("失败",500,false,data);
    return resultPojo;
  }

  @Override
  public String toString() {
    return "ResultPojo{" +
        "msg='" + msg + '\'' +
        ", code=" + code +
        ", status=" + status +
        ", data=" + data +
        '}';
  }
}
